/*jslint vars: true, plusplus: true, sloppy: true */
/*global angular, ocDialog */
ocDialog.filter("throttle", function () {
	return function throttle(fn, limit) {
		//from underscore
		var wait = false;
		return function () {
			if (!wait) {
				fn.apply(this, arguments);
				wait = true;
				setTimeout(function () {
					wait = false;
				}, limit);
			}
		};
	};
});
